package com.example.live.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.live.dto.RoomInfo;
import com.example.live.mapper.RoomInfoMapper;
import com.example.live.service.RoomInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author:zhuzewen
 * @data:2024/12/16 0016 11:24
 */
@Service
public class RoomInfoServiceImpl implements RoomInfoService {
    @Autowired
    private RoomInfoMapper roomInfoMapper;
    public void addRoomInfo(RoomInfo roomInfo) {
        roomInfoMapper.insert(roomInfo);
    }

    public void deleteRoomInfoById(String id) {
        roomInfoMapper.deleteById(id);
    }

    public void updateRoomInfo(RoomInfo roomInfo) {
        roomInfoMapper.updateById(roomInfo);
    }

    public RoomInfo getRoomInfoById(String id) {
        return roomInfoMapper.selectById(id);
    }

    public List<RoomInfo> getAllRoomInfos() {
        QueryWrapper<RoomInfo> queryWrapper=new QueryWrapper<>();
//        queryWrapper.select("id");

        return roomInfoMapper.selectList(queryWrapper);
    }
}
